<template>
  <div class="container container-scroll">
    <article-list
      :url="url"
      :params="params"
    />
  </div>
</template>

<script>
import ArticleList from '@/components/articleList/index'
export default {
  components: {
    ArticleList
  },
  props: {
    title: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      channelId: '',
      url: '/cms/article/index'
    }
  },
  computed: {
    params () {
      return {
        channel_id: this.channelId
      }
    }
  },
  onLoad (option) {
    console.log('onLoad options:', option)
    if (option.id) {
      this.channelId = option.id
    }
    const params = wx.getStorageSync('PAGE_PARAMS')
    if (params) {
      this.title = params.title
    }
  },
  onShow () {
    this.titleChange(this.title)
  },
  methods: {
    titleChange (t) {
      wx.setNavigationBarTitle({
        title: t
      })
    }
  }
}
</script>

<style lang="less">
page {
  height: 100%;
}
.container-scroll {
  position: relative;
  height: 100%;
}
</style>
